package com.by.facade.enums.sysTag;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Tian Wei
 * @version 1.0
 * @date 2024/12/31 14:47
 */
@Getter
@AllArgsConstructor
public enum SysTagTriggerTypeEnum {

    VISIT_COURSE_LINK(SysTagTriggerTypeEnum.VISIT_COURSE_LINK_CODE,"访问课时链接"),
    SPU_RECEIVE_DIVIDE_SUCCESS(SysTagTriggerTypeEnum.SPU_RECEIVE_DIVIDE_SUCCESS_CODE,"分班成功"),
    COMPLETE_COURSE(SysTagTriggerTypeEnum.COMPLETE_COURSE_CODE,"观看课时市场满足完课标准"),
    ;

    private final Integer type;
    private final String desc;
    private final static Map<Integer,SysTagTriggerTypeEnum> MAP ;
    static {
        MAP = Stream.of(SysTagTriggerTypeEnum.values()).collect(Collectors.toMap(SysTagTriggerTypeEnum::getType, Function.identity()));
    }

    public static SysTagTriggerTypeEnum resolveByType(Integer type){
        return MAP.get(type);
    }

    public static final int VISIT_COURSE_LINK_CODE = 1;
    public static final int SPU_RECEIVE_DIVIDE_SUCCESS_CODE = 2;
    public static final int COMPLETE_COURSE_CODE = 3;
}
